<template>
    <div>
<h2>充值</h2>
<table class="table table-bordered">
<tr>
    <td>积分</td>
    <td><input type="text" v-model="money" /></td>
</tr>
<tr>
    <td></td>
    <td><input type="button" value="保存" @click="upd" /></td>
</tr>
</table>
    </div>
</template>

<script setup lang="ts">
import { onMounted, reactive, toRefs } from 'vue';
import axios from 'axios';
import { useRouter, useRoute } from 'vue-router';
const router = useRouter();
const route = useRoute();
let data:any = reactive({
        money: "", 
})
let { money,num } = toRefs(data)
const upd=()=>{
    let obj = {
       id:route.query.id,
       money: money.value
    }
    axios({
        url: '/api/Member/updatemoney',
        method: 'post',
        params: obj
    })
        .then(res => {
            console.log(res)
           if(res.data.data==1){
            alert("充值成功")
            router.push("/list")
           }
           else{
            alert("充值失败")
           }

        })
        .catch(err => {
            console.log(err)
        })
}
</script>

<style scoped>

</style>